import request from "@/utils/request";
import type { melas,needSE } from "@/api/permission/melas/type";

enum API {
    // 获取
    GET_MELAS = "/admin/acl/permission",
    // 新增
    ADD_MELAS = "/admin/acl/permission/save",
    // 修改
    UPDATE_MELAS = "/admin/acl/permission/update",
    // 删除
    DELETE_MELAS = "/admin/acl/permission/remove/",
}

export const getMelas = () => request.get<any, melas>(API.GET_MELAS);

export const saveOrEdit = (data:needSE) => { 
    if (data.id) {
        return request.put(API.UPDATE_MELAS, data)
    } else { 
        return request.post(API.ADD_MELAS,data)
    }
}

export const deleteMelas = (id:number)=> request.delete<any,any>(API.DELETE_MELAS+id)
